package com.example.medicine.Mapper;



import com.example.medicine.Bean.jingfangWithCompany;
import com.example.medicine.Bean.yian.yian;
import com.example.medicine.Bean.yian.yianWithCompany;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


@Mapper
public interface xslrMapper {
//    @Select("select * from [dbo].[yian] where createuser IN (SELECT userid FROM yonghu WHERE type='学生') ORDER BY createuser")
//    List<yian> getAll();
    @Select("SELECT yian.*,yh.company\n" +
            "            FROM yian\n" +
            "            left join(\n" +
            "            select userid,company,type \n" +
            "            from yonghu\n" +
            "            where userid in (select createuser from yian)) as yh \n" +
            "            on yian.createuser=yh.userid WHERE  yh.type='学生' ORDER BY createtime DESC;")
    List<yianWithCompany> getAll();
    @Update("update [yian] set shenhe='保存',firstcheckuser=null,firstchecktime=null,firstcheckfenshu=null," +
            "secondcheckuser=null,secondchecktime=null,secondcheckfenshu=null where id=#{id}")
    public void updateDh(long id);
}
